#include "../src/common/YXLRU.h"

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

int main() {
    YXLRU* lru = yx_lru_create(2, NULL, NULL);
    char* a = malloc(2);
    char* b = malloc(2);
    char* c = malloc(2);
    a[0] = 'a'; a[1] = '\0';
    b[0] = 'b'; b[1] = '\0';
    c[0] = 'c'; c[1] = '\0';
    // 添加元素
    yx_lru_put(lru, a, "1");
    yx_lru_put(lru, b, "2");
    yx_lru_print(lru);
    // 添加元素，触发LRU淘汰
    yx_lru_put(lru, c, "3");
    yx_lru_print(lru);
    assert(yx_lru_get(lru, a) == NULL);
    // 获取元素
    printf("%s\n", yx_lru_get(lru, b));
    yx_lru_print(lru);
    return 0;
}